package cc.wsyw126.java.Regex;

import org.junit.Assert;

import java.util.Arrays;

/**
 * Created by junpeng.yang on 16/9/1.
 */
public class TestSlash {
    /**
     * 测试slash.
     *
     * @param args
     */
    public static void main(String[] args) {
        String string = "yang\\jun|peng";
        System.out.println("string = " + string);
        String[] strings = string.split("\\\\|\\|");
        String[] strings1 = string.split("[an|]");
        String[] strings2 = string.split("[an\\|]]");

        System.out.println("strings2.length,strings1.length:"
                + strings2.length + "," + strings1.length);


        Arrays.stream(strings).forEach(s -> System.out.println("s = " + s));
        Arrays.stream(strings1).forEach(s -> System.out.println("s1 = " + s));
        Arrays.stream(strings2).forEach(s -> System.out.println("s2 = " + s));
        Assert.assertEquals("equals", strings1, strings2);
    }
}
